const express = require("express");
const router = express.Router();

/**
 * @api {post} /api/user/login 登录
 * @apiGroup user
 * @apiParam {String}  phoneNumber/email 手机号/邮箱  
 * @apiParam {String}  password 密码
 * @apiSampleRequest /api/user/login
 * @apiSuccess {json} result
 * @apiVersion 1.0.0 
 */

router.post("/login", require('./user/login'));

/**
 * @api {post} /api/user/register 登录
 * @apiGroup user
 * @apiParam {String}  phoneNumber,email,password,nickname 手机号,邮箱,密码,昵称  
 * @apiSuccess {json} result
 * @apiVersion 1.0.0 
 */

router.post("/register", require("./user/register"));

/**
 * @api {GET} /api/user/userInfo 获取用户信息
 * @apiGroup user
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/userInfo
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

router.get("/userInfo", require('./user/userInfo'));

/**
 * @api {PUT} /api/user/resetpwd 修改密码
 * @apiGroup user
 * @apiParam  {user_id,oldpwd,newpwd}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetpwd
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

 router.put("/resetpwd", require("./user/account/resetpwd"));

/**
 * @api {GET} /api/user/follows 关注的人
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/follows
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

 router.get("/follows", require('./user/getfollows'));

 /**
 * @api {GET} /api/user/myfans 我的粉丝
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/myfans
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.get("/fans", require('./user/getfans'));

  /**
 * @api {POST} /api/user/collect 收藏商品
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/collect
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.post("/collect", require('./user/collections/collect'));

    /**
 * @api {DELETE} /api/user/collect 删除收藏
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/collect
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.delete("/collect", require('./user/collections/delCollections'));

  /**
 * @api {GET} /api/user/collect 收藏商品
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/collect
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.get("/collections", require('./user/collections/getCollections'));


/**
 * @api {GET} /api/user/iscollect 是否收藏
 * @apiGroup user
 * @apiParam  {user_id, Art_No}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/iscollect
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.get("/iscollect", require('./user/collections/iscollect'));

  
 /**
 * @api {GET} /api/user/mypubnum 上传商品
 * @apiGroup user
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/mypubnum
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.get("/mypubnum", require('./user/commodity/mypubNum'));

 /**
 * @api {POST} /api/user/uploadbook 上传商品
 * @apiGroup user
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/uploadbook
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.post("/uploadbook", require('./user/commodity/uploadbook'));

 /**
 * @api {PUT} /api/user/delPublish 下架商品
 * @apiGroup user
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/delPublish
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.delete("/delPublish", require('./user/commodity/withdraw'));


 /**
 * @api {GET} /api/user/mypublish 我发布的
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/mypublish
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.get("/mypublish", require('./user/commodity/mypublish'));

/**
 * @api {PUT} /api/user/resetnickname 修改昵称
 * @apiGroup user
 * @apiParam  {user_id, nickname}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetnickname
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

 router.put("/resetnickname", require("./user/account/nickname"));
 
 /**
 * @api {PUT} /api/user/resetavatar 修改头像
 * @apiGroup user
 * @apiParam  {user_id, avatar}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetavatar
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.post("/resetavatar", require("./user/account/avatar"));

    /**
 * @api {PUT} /api/user/resetsex 修改性别
 * @apiGroup user
 * @apiParam  {user_id, sex}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetsex 
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

 router.put("/resetsex", require("./user/account/sex"));

     /**
 * @api {PUT} /api/user/resetaddress 修改所在地
 * @apiGroup user
 * @apiParam  {user_id, address}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetaddress
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.put("/resetaddress", require("./user/account/address"));

  /**
 * @api {PUT} /api/user/resetsignature 修改签名
 * @apiGroup user
 * @apiParam  {user_id, signature}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetsignature
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

 router.put("/resetsignature", require("./user/account/signature"));

   /**
 * @api {PUT} /api/user/resetsummary 修改签名
 * @apiGroup user
 * @apiParam  {user_id, signature}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetsummary
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

    router.put("/resetsummary", require("./user/account/summary"));

   /**
 * @api {PUT} /api/user/receivingAddress 修改收货地址
 * @apiGroup user
 * @apiParam  {user_id,consignee,phoneNumber,area,detailAddress,postalCode}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/receivingAddress
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.put("/receivingAddress", require("./user/account/setReceivingAddress"));

/**
 * @api {DELETE} /api/user/receivingAddress 删除收货地址
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/receivingAddress
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

  router.delete("/receivingAddress", require("./user/account/delAddress"));

  /**
 * @api {GET} /api/user/resetReceivingAddress 增加收货地址
 * @apiGroup user
 * @apiParam  {user_id}
 * @apiHeader {String}  Authorization token
 * @apiSampleRequest /api/user/resetReceivingAddress
 * @apiSuccess {json} result
 * @apiVersion 1.0.0
 */

   router.get("/receivingAddress", require("./user/account/receivingAddress"));


module.exports = router;
